package info.lumanman.switchdatabase.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import info.lumanman.switchdatabase.one.dao.UserDao;
import info.lumanman.switchdatabase.one.dao.UserDetailDao;
import info.lumanman.switchdatabase.one.entry.User;
import info.lumanman.switchdatabase.one.entry.UserDetail;
import info.lumanman.switchdatabase.service.BookService;
import info.lumanman.switchdatabase.service.UserDetailService;
import info.lumanman.switchdatabase.service.UserService;

@Service("userService")
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userdao;
	
	@Autowired
	private UserDetailService userDetailService;

	@Override
	public List<User> getUserList() {
		List<User> userList = userdao.getUserList();
		return userList;
	}

	@Override
	public int saveUser(User user) {
		userdao.saveUser(user);
		
		
		UserDetail userDetail=new UserDetail();
		userDetail.setfAddress("11");
		userDetail.setfId("22");
		userDetail.setfUserId(user.getfId());
		userDetail.setfPhone("33");
		userDetailService.saveUserDetail(userDetail);
		return 0;
	}
	

}
